package test;


import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main1 {

	public static void main(String[] args) {
		 Set<String> set = new TreeSet();  
		
		 Scanner in = new Scanner(System.in);
		 while(in.hasNext()){
			 String s = in.next();
			 if (s.equals("!!!!!"))break;
			 set.add(s);
		 }
		 System.out.println(set.size());
		 if(set.size() < 10)
			for(String str : set){
				System.out.println(str);
			}
		 else 
		 {
			 
			for (int i = 0; i < 10 ; i++) {
			System.out.println(set.toArray()[i]);
		}
		 }
	}	 

}
